<?php /* Smarty version 2.6.20, created on 2011-12-03 16:26:52
         compiled from C:%5CD%5CMarocMall/themes/prestashop/order-address.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'counter', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 48, false),array('function', 'l', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 69, false),array('modifier', 'html_entity_decode', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 65, false),array('modifier', 'floatval', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 66, false),array('modifier', 'intval', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 67, false),array('modifier', 'escape', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 171, false),array('modifier', 'count', 'C:\\D\\MarocMall/themes/prestashop/order-address.tpl', 177, false),)), $this); ?>


<?php if (! isset ( $this->_tpl_vars['formatedAddressFieldsValuesList'] )): ?>
	<?php echo $this->_tpl_vars['ignoreList']['0']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['1']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['2']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['3']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['4']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['5']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['6']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['7']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['8']; ?>

	<?php echo $this->_tpl_vars['ignoreList']['9']; ?>
	
	
		<?php if (isset ( $this->_tpl_vars['addresses'] )): ?>
		<?php $_from = $this->_tpl_vars['addresses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['address']):
?>
			<?php echo smarty_function_counter(array('start' => 0,'skip' => 1,'assign' => 'address_key_number'), $this);?>

			<?php echo $this->_tpl_vars['id_address']; ?>

			<?php $_from = $this->_tpl_vars['address']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['address_key'] => $this->_tpl_vars['address_content']):
?>
				<?php if (! in_array ( $this->_tpl_vars['address_key'] , $this->_tpl_vars['ignoreList'] )): ?>
					<?php echo $this->_tpl_vars['formatedAddressFieldsValuesList'][$this->_tpl_vars['id_address']]['ordered_fields'][$this->_tpl_vars['address_key_number']]; ?>

					<?php echo $this->_tpl_vars['formatedAddressFieldsValuesList'][$this->_tpl_vars['id_address']]['formated_fields_values'][$this->_tpl_vars['address_key']]; ?>

					<?php echo smarty_function_counter(array(), $this);?>

				<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		<?php endforeach; endif; unset($_from); ?>
	<?php endif; ?>
<?php endif; ?>

<script type="text/javascript">
// <![CDATA[
	<?php if (! $this->_tpl_vars['opc']): ?>
	var orderProcess = 'order';
	var currencySign = '<?php echo ((is_array($_tmp=$this->_tpl_vars['currencySign'])) ? $this->_run_mod_handler('html_entity_decode', true, $_tmp, 2, "UTF-8") : html_entity_decode($_tmp, 2, "UTF-8")); ?>
';
	var currencyRate = '<?php echo ((is_array($_tmp=$this->_tpl_vars['currencyRate'])) ? $this->_run_mod_handler('floatval', true, $_tmp) : floatval($_tmp)); ?>
';
	var currencyFormat = '<?php echo ((is_array($_tmp=$this->_tpl_vars['currencyFormat'])) ? $this->_run_mod_handler('intval', true, $_tmp) : intval($_tmp)); ?>
';
	var currencyBlank = '<?php echo ((is_array($_tmp=$this->_tpl_vars['currencyBlank'])) ? $this->_run_mod_handler('intval', true, $_tmp) : intval($_tmp)); ?>
';
	var txtProduct = "<?php echo smartyTranslate(array('s' => 'product'), $this);?>
";
	var txtProducts = "<?php echo smartyTranslate(array('s' => 'products'), $this);?>
";
	<?php endif; ?>

	var formatedAddressFieldsValuesList = new Array();

	<?php $_from = $this->_tpl_vars['formatedAddressFieldsValuesList']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['id_address'] => $this->_tpl_vars['type']):
?>
		formatedAddressFieldsValuesList[<?php echo $this->_tpl_vars['id_address']; ?>
] =
		{
			'ordered_fields':[
				<?php $_from = $this->_tpl_vars['type']['ordered_fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['inv_loop'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['inv_loop']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['num_field'] => $this->_tpl_vars['field_name']):
        $this->_foreach['inv_loop']['iteration']++;
?>
					<?php if (! ($this->_foreach['inv_loop']['iteration'] <= 1)): ?>,<?php endif; ?>"<?php echo $this->_tpl_vars['field_name']; ?>
"
				<?php endforeach; endif; unset($_from); ?>
			],
			'formated_fields_values':{
					<?php $_from = $this->_tpl_vars['type']['formated_fields_values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['inv_loop'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['inv_loop']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['pattern_name'] => $this->_tpl_vars['field_name']):
        $this->_foreach['inv_loop']['iteration']++;
?>
						<?php if (! ($this->_foreach['inv_loop']['iteration'] <= 1)): ?>,<?php endif; ?>"<?php echo $this->_tpl_vars['pattern_name']; ?>
":"<?php echo $this->_tpl_vars['field_name']; ?>
"
					<?php endforeach; endif; unset($_from); ?>
				}
		}
	<?php endforeach; endif; unset($_from); ?>

	function getAddressesTitles()
	{
		return {
						'invoice': "<?php echo smartyTranslate(array('s' => 'Your billing address'), $this);?>
",
						'delivery': "<?php echo smartyTranslate(array('s' => 'Your delivery address'), $this);?>
"
			};

	}


	function buildAddressBlock(id_address, address_type, dest_comp)
	{
		var adr_titles_vals = getAddressesTitles();
		var li_content = formatedAddressFieldsValuesList[id_address]['formated_fields_values'];
		var ordered_fields_name = ['title'];

		ordered_fields_name = ordered_fields_name.concat(formatedAddressFieldsValuesList[id_address]['ordered_fields']);
		ordered_fields_name = ordered_fields_name.concat(['update']);
		
		dest_comp.html('');

		li_content['title'] = adr_titles_vals[address_type];
		li_content['update'] = '<a href="<?php echo $this->_tpl_vars['link']->getPageLink('address.php',true); ?>
?id_address='+id_address+'&amp;back=order.php?step=1<?php if ($this->_tpl_vars['back']): ?>&mod=<?php echo $this->_tpl_vars['back']; ?>
<?php endif; ?>" title="<?php echo smartyTranslate(array('s' => 'Update'), $this);?>
"><?php echo smartyTranslate(array('s' => 'Update'), $this);?>
</a>';

		appendAddressList(dest_comp, li_content, ordered_fields_name);
	}

	function appendAddressList(dest_comp, values, fields_name)
	{
		for (var item in fields_name)
		{
			var name = fields_name[item];
			var value = getFieldValue(name, values);
			if (value != "")
			{
				var new_li = document.createElement('li');
				new_li.className = 'address_'+ name;
				new_li.innerHTML = getFieldValue(name, values);
				dest_comp.append(new_li);
			}
		}
	}

	function getFieldValue(field_name, values)
	{
		var reg=new RegExp("[ ]+", "g");

		var items = field_name.split(reg);
		var vals = new Array();

		for (var field_item in items)
			vals.push(values[items[field_item]]);
		return vals.join(" ");
	}

//]]>
</script>

<?php if (! $this->_tpl_vars['opc']): ?>
<?php ob_start(); ?><?php echo smartyTranslate(array('s' => 'Addresses'), $this);?>
<?php $this->_smarty_vars['capture']['path'] = ob_get_contents(); ob_end_clean(); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ($this->_tpl_vars['tpl_dir'])."./breadcrumb.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php endif; ?>

<?php if (! $this->_tpl_vars['opc']): ?><h1><?php echo smartyTranslate(array('s' => 'Addresses'), $this);?>
</h1><?php else: ?><h2>1. <?php echo smartyTranslate(array('s' => 'Addresses'), $this);?>
</h2><?php endif; ?>

<?php if (! $this->_tpl_vars['opc']): ?>
<?php $this->assign('current_step', 'address'); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ($this->_tpl_vars['tpl_dir'])."./order-steps.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ($this->_tpl_vars['tpl_dir'])."./errors.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<form action="<?php echo $this->_tpl_vars['link']->getPageLink('order.php',true); ?>
" method="post">
<?php else: ?>
<div id="opc_account" class="opc-main-block">
	<div id="opc_account-overlay" class="opc-overlay" style="display:none;"></div>
<?php endif; ?>
	<div class="addresses">
		<p class="address_delivery select">
			<label for="id_address_delivery"><?php echo smartyTranslate(array('s' => 'Choose a delivery address:'), $this);?>
</label>
			<select name="id_address_delivery" id="id_address_delivery" class="address_select" onchange="updateAddressesDisplay();<?php if ($this->_tpl_vars['opc']): ?>updateAddressSelection();<?php endif; ?>">

			<?php $_from = $this->_tpl_vars['addresses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['address']):
?>
				<option value="<?php echo ((is_array($_tmp=$this->_tpl_vars['address']['id_address'])) ? $this->_run_mod_handler('intval', true, $_tmp) : intval($_tmp)); ?>
" <?php if ($this->_tpl_vars['address']['id_address'] == $this->_tpl_vars['cart']->id_address_delivery): ?>selected="selected"<?php endif; ?>><?php echo ((is_array($_tmp=$this->_tpl_vars['address']['alias'])) ? $this->_run_mod_handler('escape', true, $_tmp, 'htmlall', 'UTF-8') : smarty_modifier_escape($_tmp, 'htmlall', 'UTF-8')); ?>
</option>
			<?php endforeach; endif; unset($_from); ?>
			
			</select>
		</p>
		<p class="checkbox" <?php if ($this->_tpl_vars['cart']->isVirtualCart()): ?>style="display:none;"<?php endif; ?>>
			<input type="checkbox" name="same" id="addressesAreEquals" value="1" onclick="updateAddressesDisplay();<?php if ($this->_tpl_vars['opc']): ?>updateAddressSelection();<?php endif; ?>" <?php if ($this->_tpl_vars['cart']->id_address_invoice == $this->_tpl_vars['cart']->id_address_delivery || count($this->_tpl_vars['addresses']) == 1): ?>checked="checked"<?php endif; ?> />
			<label for="addressesAreEquals"><?php echo smartyTranslate(array('s' => 'Use the same address for billing.'), $this);?>
</label>
		</p>
		
		<p id="address_invoice_form" class="select" <?php if ($this->_tpl_vars['cart']->id_address_invoice == $this->_tpl_vars['cart']->id_address_delivery): ?>style="display: none;"<?php endif; ?>>
		
		<?php if (count($this->_tpl_vars['addresses']) > 1): ?>
			<label for="id_address_invoice" class="strong"><?php echo smartyTranslate(array('s' => 'Choose a billing address:'), $this);?>
</label>
			<select name="id_address_invoice" id="id_address_invoice" class="address_select" onchange="updateAddressesDisplay();<?php if ($this->_tpl_vars['opc']): ?>updateAddressSelection();<?php endif; ?>">
			<?php unset($this->_sections['address']);
$this->_sections['address']['loop'] = is_array($_loop=$this->_tpl_vars['addresses']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['address']['step'] = ((int)-1) == 0 ? 1 : (int)-1;
$this->_sections['address']['name'] = 'address';
$this->_sections['address']['show'] = true;
$this->_sections['address']['max'] = $this->_sections['address']['loop'];
$this->_sections['address']['start'] = $this->_sections['address']['step'] > 0 ? 0 : $this->_sections['address']['loop']-1;
if ($this->_sections['address']['show']) {
    $this->_sections['address']['total'] = min(ceil(($this->_sections['address']['step'] > 0 ? $this->_sections['address']['loop'] - $this->_sections['address']['start'] : $this->_sections['address']['start']+1)/abs($this->_sections['address']['step'])), $this->_sections['address']['max']);
    if ($this->_sections['address']['total'] == 0)
        $this->_sections['address']['show'] = false;
} else
    $this->_sections['address']['total'] = 0;
if ($this->_sections['address']['show']):

            for ($this->_sections['address']['index'] = $this->_sections['address']['start'], $this->_sections['address']['iteration'] = 1;
                 $this->_sections['address']['iteration'] <= $this->_sections['address']['total'];
                 $this->_sections['address']['index'] += $this->_sections['address']['step'], $this->_sections['address']['iteration']++):
$this->_sections['address']['rownum'] = $this->_sections['address']['iteration'];
$this->_sections['address']['index_prev'] = $this->_sections['address']['index'] - $this->_sections['address']['step'];
$this->_sections['address']['index_next'] = $this->_sections['address']['index'] + $this->_sections['address']['step'];
$this->_sections['address']['first']      = ($this->_sections['address']['iteration'] == 1);
$this->_sections['address']['last']       = ($this->_sections['address']['iteration'] == $this->_sections['address']['total']);
?>
				<option value="<?php echo ((is_array($_tmp=$this->_tpl_vars['addresses'][$this->_sections['address']['index']]['id_address'])) ? $this->_run_mod_handler('intval', true, $_tmp) : intval($_tmp)); ?>
" <?php if ($this->_tpl_vars['addresses'][$this->_sections['address']['index']]['id_address'] == $this->_tpl_vars['cart']->id_address_invoice && $this->_tpl_vars['cart']->id_address_delivery != $this->_tpl_vars['cart']->id_address_invoice): ?>selected="selected"<?php endif; ?>><?php echo ((is_array($_tmp=$this->_tpl_vars['addresses'][$this->_sections['address']['index']]['alias'])) ? $this->_run_mod_handler('escape', true, $_tmp, 'htmlall', 'UTF-8') : smarty_modifier_escape($_tmp, 'htmlall', 'UTF-8')); ?>
</option>
			<?php endfor; endif; ?>
			</select>
			<?php else: ?>
				<a style="margin-left: 221px;" href="<?php echo $this->_tpl_vars['link']->getPageLink('address.php',true); ?>
?back=order.php?step=1&select_address=1<?php if ($this->_tpl_vars['back']): ?>&mod=<?php echo $this->_tpl_vars['back']; ?>
<?php endif; ?>" title="<?php echo smartyTranslate(array('s' => 'Add'), $this);?>
" class="button_large"><?php echo smartyTranslate(array('s' => 'Add a new address'), $this);?>
</a>
			<?php endif; ?>
		</p>
		<div class="clear"></div>
		<ul class="address item" id="address_delivery" <?php if ($this->_tpl_vars['cart']->isVirtualCart()): ?>style="display:none;"<?php endif; ?>>
		</ul>
		<ul class="address alternate_item <?php if ($this->_tpl_vars['cart']->isVirtualCart()): ?>full_width<?php endif; ?>" id="address_invoice">
		</ul>
		<br class="clear" />
		<p class="address_add submit">
			<a href="<?php echo $this->_tpl_vars['link']->getPageLink('address.php',true); ?>
?back=order.php?step=1<?php if ($this->_tpl_vars['back']): ?>&mod=<?php echo $this->_tpl_vars['back']; ?>
<?php endif; ?>" title="<?php echo smartyTranslate(array('s' => 'Add'), $this);?>
" class="button_large"><?php echo smartyTranslate(array('s' => 'Add a new address'), $this);?>
</a>
		</p>
		<?php if (! $this->_tpl_vars['opc']): ?>
		<div id="ordermsg">
			<p><?php echo smartyTranslate(array('s' => 'If you would like to add a comment about your order, please write it below.'), $this);?>
</p>
			<p class="textarea"><textarea cols="60" rows="3" name="message"><?php if (isset ( $this->_tpl_vars['oldMessage'] )): ?><?php echo $this->_tpl_vars['oldMessage']; ?>
<?php endif; ?></textarea></p>
		</div>
		<?php endif; ?>
	</div>
<?php if (! $this->_tpl_vars['opc']): ?>
	<p class="cart_navigation submit">
		<input type="hidden" class="hidden" name="step" value="2" />
		<input type="hidden" name="back" value="<?php echo $this->_tpl_vars['back']; ?>
" />
		<a href="<?php echo $this->_tpl_vars['link']->getPageLink('order.php',true); ?>
?step=0<?php if ($this->_tpl_vars['back']): ?>&back=<?php echo $this->_tpl_vars['back']; ?>
<?php endif; ?>" title="<?php echo smartyTranslate(array('s' => 'Previous'), $this);?>
" class="button">&laquo; <?php echo smartyTranslate(array('s' => 'Previous'), $this);?>
</a>
		<input type="submit" name="processAddress" value="<?php echo smartyTranslate(array('s' => 'Next'), $this);?>
 &raquo;" class="exclusive" />
	</p>
</form>
<?php else: ?>
</div>
<?php endif; ?>